package main

import (
	"cli"
	"github.com/clearcodecn/clearcode/hook"
	"os"
	"log"
)

//  go install -ldflags "-X git.ycyz.org/cash/auth/controllers.Version=`git rev-parse HEAD`"
var rootCmd = cli.NewApp()

func init()  {
	rootCmd.Name = "clearcode"
	rootCmd.Commands = []cli.Command{
		{
			Name:                   "webhook",
			ShortName:              "w",
			Aliases:                nil,
			Usage:                  "webhook",
			UsageText:              "start webhook",
			Before:                 hook.Before,
			Action:                 hook.Action,
			Flags:                  []cli.Flag{
				cli.StringFlag{
					Name:        "config,c",
					Usage:       "config file",
					EnvVar:      "CLEARCODE_CONFIG",
				},
			},
		},
	}

}

func main()  {
	err := rootCmd.Run(os.Args)
	if err != nil {
		log.Print("err:",err)
	}
}